<?php
  include("./config.php");
  $TBL_CONFIG = $conf["tbl_prefix"] . "config";   //配置文件
 /* 处理上传的数据 */
  if ($_POST)
  {
   $site_name = $_POST["site_name"];      //网站名称 加
   $site_desc = $_POST["site_desc"];      //网站说明
   $site_ban = $_POST["site_ban"];        //版权所有加
   $site_keywords = $_POST["site_keywords"];//关键字加
    
   /* 更新数据表 */
     $query = "UPDATE $TBL_CONFIG SET site_name='$site_name',site_desc='$site_desc',site_ban='$site_ban',site_keywords='$site_keywords' WHERE id='1'";
	 $res = mysql_query($query);	
	 MyNotice("更新成功！",1,"./common_config.php");
	 exit(0);
  }

  $tpl = new PhplibTpl($conf["admin_tpl_path"]);
  $tpl -> set_file("main", "common_config.htm");

 /* 查询配置表 */
  $query = "SELECT * FROM $TBL_CONFIG where id =1";
  $res = @mysql_query($query);
  while ($rows = @mysql_fetch_array($res))
  {
	$tpl -> set_var(array(						
						"id" => $rows["id"],
						"site_name"=> $rows["site_name"],
						"site_desc" => $rows["site_desc"],
						"site_ban" => $rows["site_ban"],
						"site_keywords" => $rows["site_keywords"],
		                ));
  }
  $tpl -> set_var($conf_data);
  $tpl -> set_var($conf);
  $tpl -> parse("Out_main", "main");
  $tpl -> p("Out_main");
?>